
Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox1.Focus()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim conn As New OracleConnection(oradb) ' VB.NET

        conn.ConnectionString = oradb
        Dim dr As OracleDataReader  ' Visual Basic
        Try
            conn.Open()

            Dim cmd As New OracleCommand
            cmd.Connection = conn
            cmd.CommandText = "Select Id,Nombre,Apellido FROM Usuarios " 'where nombre='" + TextBox1.Text + "'"
            cmd.CommandType = CommandType.Text

            dr = cmd.ExecuteReader() ' Visual Basic
            'dr.Read()
            If dr.Read() Then
                TextBox1.Text = dr.Item("apellido").ToString
                TextBox2.Text = dr.Item("id").ToString
            End If
        Catch ex As Exception ' catches any error
            MessageBox.Show(ex.Message.ToString())
        Finally
            ' In a real application, put cleanup code here.
            conn.Close()
        End Try
    End Sub

End Class
